import {isArray, isEmpty} from 'lodash';

type ArrayItemType<T> = T extends Array<infer U> ? U : T;
export const normalizeArray = <T>(data: T): ArrayItemType<T>[] => {
    if (isEmpty(data)) {
        return [];
    }
    return (isArray(data) ? data : [data]) as ArrayItemType<T>[];
};
